<%-- 
    Document   : listOfOrders
    Created on : Apr 19, 2013, 8:34:59 AM
    Author     : Alexandra
--%>
<%@page import="com.charlie.beans.ShipmentOrder"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.List"%>

<%@include file="../header.jsp" %>

<div class="left_side">
    <jsp:include page="/blocks/conditionalLeftBar.jsp" />
</div>

<div class="right_side">
    <h2 class="content_title">Select the order you want to serve</h2>
    <div class="white_block">
        <%
            List<ShipmentOrder> orders_list = (List<ShipmentOrder>) getServletContext().getAttribute("orderList");
            if (orders_list != null) {
            SimpleDateFormat format = new SimpleDateFormat("MMM dd,yyyy");
        %>
        <table class="typycal_table">
            <thead>
                <tr class="underLinedRow"> 
                    <th> id  </th>
                    <th> creation date</th>
                    <th> user e-mail</th>
                    <th> location </th>
                </tr>
            </thead>
            <tbody>
                <%
                    for (ShipmentOrder item : orders_list) {%>
                <tr>
                    <td>
                        <%=item.getSoId()%>
                    </td>
                    <td>
                        <%=format.format(item.getCreationDate())%>
                    </td>
                    <td>
                        <% if (item.getEmail()!=null) out.println(item.getEmail());
                                                  else out.println(" no info ");                        
                        %>
                    </td>
                    <td>
                        <%=item.getLocation()%>
                    </td> 
                    <td>
                        <form method="GET" action="${pageContext.request.contextPath}/warehouse/order"/>
                            <input name="idOfOrder" type="hidden" value="<%=item.getSoId()%>">
                            <input class="btn" value="Serve" type="submit" > 
                        </form>
                    </td>
                </tr>
                <%  } %>
            </tbody>
        </table>
    <%
        } else {
            out.print("<h1>No orders</h1>");
        }
    %>
    </div>

    <jsp:include page="/blocks/pages.jsp">
        <jsp:param name="path" value="warehouse/orders" />
    </jsp:include>
</div>
<%@include file="/footer.jsp" %>